<%@ page import=" java.util.Date, 
			java.sql.Connection, java.sql.PreparedStatement,
 			java.sql.ResultSet, java.text.SimpleDateFormat, 
 			java.util.TimeZone;" language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
    <jsp:useBean id="member" class="com.kamikaze.Member" scope="session" />
    <jsp:useBean id="leave" class="com.kamikaze.Leave" scope="session" />
<%
java.util.Date now = new java.util.Date(); //取得現在時間
SimpleDateFormat dd = new SimpleDateFormat("yyyy-MM-dd");
String day = dd.format(now);
%>

<sql:query var="rs" dataSource="jdbc/j2db" >
SELECT ld.leaved_number,s.shift_number,us.user_id,us.user_name,ld.leaved_date,
ld.leaved_time_begin,ld.leaved_time_end,ld.check,ld.checker_id,ld.leave_note,l.leave_name,leaved_time,l.leave_number
from shift s , leavedata ld , users us ,leaves l 
where s.user_id = us.user_id and 
s.shift_number = ld.shift_number and
ld.leave_number = l.leave_number and
leaved_number=?
<sql:param>${param.id }</sql:param>
</sql:query>
	<form action="leavedo" method="post">
<table border=1>
				<tr>
					<th>請假編號</th>
					<th>班表編號</th>
					<th>員工編號</th>
					<th>員工姓名</th>
					<th>請假日期</th>
					<th>起始時間</th>
					<th>結束時間</th>
					<th>假別編號</th>
					<th>假別</th>
					<th>申請時間</th>
					<th>核可</th>
					<th>核可主管</th>
					<th>備註</th>

				</tr>
				
			
<c:forEach var="r" items="${rs.rows}">
					<tr>
						<td><input type="hidden" id="leaved_number" name="leaved_number" value="${r.leaved_number }">${r.leaved_number }</td>
						<td>${r.shift_number }</td>
						<td>${r.user_id }</td>
						<td>${r.user_name }</td>
						<td><input type="text" id="leaved_date" name="leaved_date" value="${r.leaved_date }"> </td>
						<td><input type="text" id="leaved_time_begin" name="leaved_time_begin" value="${r.leaved_time_begin }"></td>
						<td><input type="text" id="leaved_time_end" name="leaved_time_end" value="${r.leaved_time_end }"></td>
						<td><input type="text" id="leave_number" name="leave_number" value="${r.leave_number }"></td>
						<td>${r.leave_name }</td>
						<td>${r.leaved_time }</td>
						<td>${r.approved }</td>
						<td>${r.checker_id }</td>
						<td><input type="text" id="leave_note" name="leave_note" value="${r.leave_note }"></td>
						
					</tr>


</c:forEach>
</table>
<br>
<input type="submit" value="送出">
</form>
<%
for (String msg : leave.getErrors()) {
	%><h2><%=msg %></h2><%	
}
%>